<?php
/**
 * Unfuddle Milestone Model
 *
 * @package     Unfuddle
 * @subpackage  Data Models
 * @author      Luke Visinoni <luke.visinoni@gmail.com>
 * @copyright   (c) 2010 Luke Visinoni <luke.visinoni@gmail.com>
 * @version     $Id: Milestone.php 29 2011-05-09 07:08:53Z luke.visinoni $
 */
class Unfuddle_Model_Milestone extends Unfuddle_Model_Abstract {

    /**
     * Return collection of milestones
     */
    const URI_MILESTONES = '/milestones';
    
    /**
     * Return collection of milestones for given project
     */
    const URI_PROJECT_MILESTONES = '/projects/%d/milestones';
    
    /**
     * Access a milestone by project id and milestone id
     */
    const URI_MILESTONE_BY_ID = '/projects/%d/milestones/%d';
    
    /**
     * Return collection of upcoming/late/completed/archived milestones
     */
    const URI_MILESTONES_UPCOMING = '/milestones/upcoming';
    const URI_MILESTONES_LATE = '/milestones/late';
    const URI_MILESTONES_COMPLETED = '/milestones/completed';
    const URI_MILESTONES_ARCHIVED = '/milestones/archived';
    
    /**
     * Return collection of upcoming/late/completed/archived milestones for a given project
     */
    const URI_PROJECT_MILESTONES_UPCOMING = '/projects/%d/milestones/upcoming';
    const URI_PROJECT_MILESTONES_LATE = '/projects/%d/milestones/late';
    const URI_PROJECT_MILESTONES_COMPLETED = '/projects/%d/milestones/completed';
    const URI_PROJECT_MILESTONES_ARCHIVED = '/projects/%d/milestones/archived';
    
    /**
     * @var string Model name
     */
    protected $_name = 'milestone';
    
    /**
     * @var array Model fields
     */
    protected $_fields = array (
        'archived' => array('type' => 'boolean', 'required' => false, 'read-only' => false),
        'completed' => array('type' => 'boolean', 'required' => false, 'read-only' => false),
        'created-at' => array('type' => 'datetime', 'required' => false, 'read-only' => true),
        'due-on' => array('type' => 'date', 'required' => false, 'read-only' => false),
        'due-on-formatted' => array('type' => 'text', 'required' => false, 'read-only' => true),
        'id' => array('type' => 'integer', 'required' => false, 'read-only' => true),
        'person-responsible-id' => array('type' => 'integer', 'required' => false, 'read-only' => false),
        'project-id' => array('type' => 'integer', 'required' => false, 'read-only' => true),
        'title' => array('type' => 'text', 'required' => false, 'read-only' => false),
        'updated-at' => array('type' => 'datetime', 'required' => false, 'read-only' => true),
    );

}
